"""
Izumi Konata

*Booru Downloader Main Program.

Arguments:
    - update: Update post data by using Rest API (JSON or XML).
    - download: Download image post.
    - repair: Repair data.
"""

import sys

sys.path.append('lib')

import argparse
import resource.string.argument as r

formatter_class = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(description=r.description, epilog=r.epilog,
                                 formatter_class=formatter_class,
                                 prog=r.name)
parser.add_argument('action', help=r.action,
                    choices=['update', 'download', 'scan', 'verify'])
parser.add_argument('-f', '--silent', '--quiet', action="store_true",
                    help=r.silent)
parser.add_argument('-v', '--verbose', action="store_true",
                    help=r.verbose)

args = parser.parse_args()
action = args.action

import _konata

app = None
if action == 'update':
    app = _konata.Updater(args)
elif action == 'download':
    app = _konata.Downloader(args)
elif action == 'scan':
    app = _konata.Downloader(args)
elif action == 'verify':
    app = _konata.Downloader(args)

app.run()
del app
